﻿@using Classified.Service
@*<a href="@Url.Action("Create", "ClassifiedAds")" class="btn" style="float: right">
                POST A <b>FREE</b> CLASSIFIED</a>*@

                 
@model IEnumerable<Classified.Domain.Entities.ClassifiedCategory>
@{
    ViewBag.Title = "ClassifiedCategories";
    var maincategories = Model.Where(m => m.ParentCategoryId == 0);
}
<div style="margin-left: 0;" class="row">
    <div class="masonry-holder2">
        @foreach (var item in maincategories)
        {<ul style="float: left;" class="nav nav-list box">
            @{
            var subcate = Model.Where(p => p.ParentCategoryId == item.Id);
            }
            <li class="nav-header"><a href="@Url.Action("ClassifiedList", "ClassifiedAds", new { id = item.Id, seName = SeService.GetSeName(item.Name) })">
                <b>@item.Name</b></a>
                @if (subcate.Any())
                {
                    foreach (var i in subcate)
                    {
                        var subsubcate = Model.Where(p => p.ParentCategoryId == i.Id); 
                        <li><a href="@Url.Action("ClassifiedList", "ClassifiedAds", new { id = i.Id, seName = SeService.GetSeName(i.Name) })">@i.Name</a>
                        </li>
                    }
                    
                }
            </li>
        </ul>
        }</div>
</div>
<div class="clear">
</div>
<script type="text/javascript">
    $(function () {

        $('.masonry-holder2').masonry({
            itemSelector: '.box',
            columnWidth: 0,
            isAnimated: true
        });

    });
</script>

